/**
 * @file        projects.hpp
 * @brief       Defines methods related with projects.
 *
 * @author      Emre Turkay <emreturkay at gmail>
 * @date        Jun.03.2008
 */

#ifndef _PROJECTS_HPP_
#define _PROJECTS_HPP_

#include "unique_id_container.hpp"

#include <set>
#include <list>
#include <map>
#include <string>
#include <iostream>
#include <algorithm>
#include <iterator>

#include <boost/optional.hpp>

namespace gtd
{

struct action
{
    action() { }

    action(const std::string& desc, const std::set<std::string>& ctx)
        : description_(desc),
          contexts_(ctx)
    {
    }

    const std::string& description() const
    {
        return description_;
    }

    const std::set<std::string>& contexts() const
    {
        return contexts_;
    }

private:
    std::string description_;
    std::set<std::string> contexts_;
};

struct project
{
    typedef unique_id_container<action> actions;
    typedef actions::id_type action_id;

    project();

    project(const std::string& name);

    const boost::optional<std::string>& name() const;

    void prepend(const action& item);

    void append(const action& item);

    void erase(action_id index);

    bool empty() const;

    size_t item_count() const;

    std::list<action_id> items() const;

    const action& item(action_id index) const;

    action_id top() const;

private:
    boost::optional<std::string> name_;
    unique_id_container<action> actions_;
};

} // namespace gtd

#include "projects.ipp"

#endif // _PROJECTS_HPP_
